//
//  YPBaseScrollView.m
//  ChengHuiTong
//
//  Created by CHT-Technology on 2017/6/26.
//  Copyright © 2017年 张文权. All rights reserved.
//

#import "YPBaseScrollView.h"

@implementation YPBaseScrollView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.panGestureRecognizer.delegate = self;
    }
    return self;
}


//是否支持多手势触发，返回YES，则可以多个手势一起触发方法，返回NO则为互斥
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    
    return NO;
    
}

//返回YES，第一个手势和第二个互斥时，第一个会失效
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer NS_AVAILABLE_IOS(7_0){
    
    //判断是否是tabBarController.view的手势(目前判断的是系统边界pop手势),同时滑动在最左边
    if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UILayoutContainerView")] && self.contentOffset.x <= 0) {
        
        return YES;
        
    }
    
    return NO;
}

@end
